<%-- 
    Document   : Connexion
    Created on : 13 nov. 2012, 18:37:16
    Author     : jeddi
--%>

<%@page import="enterprise.web_jpa_war.entity.Adherent"%>
<%@page import="enterprise.web_jpa_war.servlet.Fonctions"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>Mediatheque : Connexion</title>
        <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
        <link type="text/css" rel="Stylesheet" media="screen" href="Css/design.css">
        <link type="text/css" rel="Stylesheet" media="screen" href="Css/bootstrap.min.css">
        <link href="Images/favicon.png" type="image/png" rel="icon">
    </head>
    <body>
        
        <%
        Fonctions f = new Fonctions();
        out.print(f.printNavBar());
        Adherent authResult = (Adherent)(request.getAttribute("resultAuth"));
        if(authResult != null) {
             HttpSession bdaSession = request.getSession(true);
             // Ajout de l'utilisateur à la session
             bdaSession.setAttribute("authUser", authResult);
        }
        %>
        
        <div class="container-fluid">
            
        <%
        out.print(f.printSideBar());
        
        HttpSession bdaSession = request.getSession();
        if(bdaSession.getAttribute("authUser") == null) {
        %>
            
        <div class="content">
            <div class="hero-unit">
                <div class="page-header">
                    <h1 id="titre">Mediatheque : Connexion</h1>
                    <h3>Connectez-vous pour pouvoir emprunter des oeuvres</h3>
                </div>
                <div class="well bloc_texte">
                    <form id="createNewOeuvre" action="Connexion" method="post">
                        <table>
                            <tr>
                                    <td>Login</td>
                                    <td><input type="text" id="login" name="login" /></td>
                            </tr>
                            <tr>
                                    <td>Mot de passe</td>
                                    <td><input type="text" id="password" name="password" /></td>
                            </tr>
                        </table>
                        <div class="actions" style="padding-left:0px">
                            <input id="btn_envoyer" class="btn large primary" type="submit" value="Se connecter">
                        </div>
                    </form>
                    <a href='index.jsp'><strong>Retour au menu principal</strong></a>
                </div>
            </div>
        </div>
        
        <% } else {
        %>
              
         <div class="content">
            <div class="hero-unit">
                <div class="page-header">
                    <h1 id="titre">Mediatheque : Connexion</h1>
                    <h3>Vous êtes connecté.</h3>
                    
                    <a href="index.jsp">Retour au menu principal</a>
                </div>
            </div>
        </div>
            
         <% } %>
    </body>
</html>

